﻿
	config.initpage = function(formNode){
		var event = formNode.event;
		
		//扩展保存前事件，计划月份不能小于当前月份
		event.on('beforesave', function(event, data) {
			var form = event.form;
			var month = form.get('contract_pay__plan_month');
			
			//转换为1号
			month = Date.parseDate(month.format('Y-m')+'-01', 'Y-m-d');
			var curmonth = JxDefault.getCurMonth();
			if (curmonth > month) {
				JxHint.alert('计划月份不能小于当前月份！');
				return false;
			}
			
			var pay_money = form.getNum('contract_pay__pay_money');
			var plan_money = form.getNum('contract_pay__plan_money');
			var contract_money = form.getNum('contract_pay__contract_money');
			if (pay_money + plan_money > contract_money) {
				JxHint.alert('提示：加上当月计划，累计付款已经超过合同金额！');
			}
			
			return true;
		});
	};